<?php
//require '../config.php';
//引入ManagerModel类
require_once dirname(__FILE__).'/../model/ManagersModel.class.php';
/*
 * 注册类(只允许注册管理员)
 */
class RegisterController{
	
	private $managerModel = null;
	
	//注册
	public function register(){
		//echo "RegisterController";
		//获取表单值(account和password以及sex)
		$account = isset($_POST['account']) ? $_POST['account'] : '';
		$password = isset($_POST['password']) ? $_POST['password'] : '';
		$sex = isset($_POST['sex']) ? $_POST['sex'] : '';
		//调用下层register函数
		$managerModel = new ManagersModel();
		$register = $managerModel->register($account, $password, $sex);
		//注册失败
		if($register !== true){
			//返回错误信息
			echo "error = ".$register;
			return $register;
		}else{
			//echo "******";
			//注册成功,返回true提示并刷新当前界面
			return true;
			//header("Location:http://localhost/SelectCoursesSystem/RegisterLogin.php");
		}
	}
}	
?>